﻿using System;
using Infrastucture;

namespace TimeSplicerModule.DomainModels
{
    public class ApplicationPermissionModel : DomainObject
    {
        private Guid _applicationPermissionGuid;
        private string _name;
        private string _applicationPermissionEnum;
        private ApplicationPermission _permission;
        private bool _isApplicationRolePermission;
        private bool _isProjectRolePermission;
        private int _hierarchy;
        private bool _isActive;



        public Guid ApplicationPermissionGuid
        {
            get { return _applicationPermissionGuid; }
            set { SetProperty(ref _applicationPermissionGuid, value); }
        }
        public string Name
        {
            get { return _name; }
            set { SetProperty(ref _name, value); }
        }
        public string PermissionEnum
        {
            get { return _applicationPermissionEnum; }
            set
            { 
                SetProperty(ref _applicationPermissionEnum, value);

                if (this.Permission.ToString() != this._applicationPermissionEnum)
                    this.UpdateEnumeration<ApplicationPermission>("Permission", value);
            }
        }
        public ApplicationPermission Permission
        {
            get { return _permission; }
            set
            {
                SetProperty(ref _permission, value);
                this.UpdateEnumerationString<ApplicationPermission>("PermissionEnum", value);
            }
        }
        public bool IsApplicationRolePermission
        {
            get { return _isApplicationRolePermission; }
            set { SetProperty(ref _isApplicationRolePermission, value); }
        }
        public bool IsProjectRolePermission
        {
            get { return _isProjectRolePermission; }
            set { SetProperty(ref _isProjectRolePermission, value); }
        }
        public int Hierarchy
        {
            get { return _hierarchy; }
            set { SetProperty(ref _hierarchy, value); }
        }
        public bool IsActive
        {
            get { return _isActive; }
            set { SetProperty(ref _isActive, value); }
        }
    }
}
